package com.baizhiedu.baizhiappsys.service.impl;

import com.baizhiedu.baizhiappsys.dao.AdminDao;
import com.baizhiedu.baizhiappsys.entity.AdminAccount;
import com.baizhiedu.baizhiappsys.service.AdminAccountService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.Map;

/**
 * @author lby
 */
@Service
public class AdminAccountServiceImpl implements AdminAccountService {
    @Autowired
    private AdminDao adminDao;

    @Override
    public Map adminLogin(String username, String password) {
        Map map = new HashMap(2);
        AdminAccount adminAccount = adminDao.selectByUsername(username);
        if(adminAccount != null){
            if(password.equals(adminAccount.getAdminPassword())){
                map.put("msg",true);
                map.put("adminAccount",adminAccount);
            }else {
                map.put("msg",false);
            }
        }else {
            map.put("msg",false);
        }
        return map;
    }
}
